<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="8-13-woek-2.html">数组去重</a>
<script>
    //冒泡排序
    var num = prompt('请输入一组数，用中文逗号分隔')
    var arr = num.split('，')
    for (var i = 0; i<arr.length-1; i++){
        for (var j = 0; j<arr.length-i-1; j++){
            arr[j] =parseInt(arr[j])
            if (arr[j]>arr[j+1]){
                var temp = arr[j]
                arr[j] = arr[j+1]
                arr[j+1] = temp
            }
        }
    }
    document.write('<br />')
    document.write('从大到小排序为: '+arr)
</script>
</body>
</html>